import junit.framework.*;	

public class LiczbaTest3 extends TestCase {

  private int chosenNumber = 29;
  private Liczba l = new Liczba();
  
  public void testDecimal_To_Hex_Equals_The_Expected_Result_Returns_True(){
	  String expectedResult = "1D";
	  
	  assertEquals(expectedResult, l.decimalToOtherNumericSystem(chosenNumber,16));
  }
  
  public void testDecimal_To_Binary_Equals_The_Expected_Result_Returns_True(){
	  String expectedResult = "11101";
	  
	  assertEquals(expectedResult, l.decimalToOtherNumericSystem(chosenNumber,2));
  }
  
  public void testDecimal_To_Octal_Equals_The_Expected_Result_Returns_Message(){
	  String expectedResult = "35";
	  
	  assertEquals("You passed",expectedResult, l.decimalToOtherNumericSystem(chosenNumber,8));
  }
  
  public void testLiczba_Instance_Is_Not_Null_Returns_True(){
	  assertNotNull(l);
  }
  
  public void testDecimal_To_Octal_The_Expected_Result_Is_Ture(){
	  String expectedResult = "35";
	  
	  assertTrue(expectedResult.equals(l.decimalToOtherNumericSystem(chosenNumber,8)));
  }
  
  public void testDecimal_To_Base_9_Equals_The_Expected_Result_Returns_True(){
	  String expectedResult = "32";
	  
	  assertEquals(expectedResult, l.decimalToOtherNumericSystem(chosenNumber, 9));
  }
  
  public void testLiczba_Check_For_Exception(){
	  try {
		  l.decimalToOtherNumericSystem(chosenNumber, 999999999);
		  fail(); // If no exception is thrown upon previous method call than fail test
	  }
	  catch(java.lang.ArrayIndexOutOfBoundsException e){
		  // If ArrayIndexOutOfBounds exception was thrown then test succeeded
	  }
	  catch(Exception e){
		  fail(); // Fail if any other exception was thrown
	  }
  }
}